var express = require('express');
var router = express.Router();

var { request } = require('../utils/request');

const BASE_URL  = 'http://v3.wufazhuce.com:8000';

// /* GET users listing. */
// router.get('/', function(req, res, next) {
//   res.send('respond with a resource');
// });

router.get('/post', function(req, res) {
  request(`${BASE_URL}/api/hp/idlist/0`).then(data => {
    res.send(data);
  });
});

router.get('/post/month/:month', function(req, res) {
  request(`${BASE_URL}/api/hp/bymonth/${req.params.month}`).then(data => {
    res.send(data);
  });
});

router.get('/post/detail/:id', function(req, res) {
  // res.send(req.params.id);
  request(`${BASE_URL}/api/hp/detail/${req.params.id}`).then(data => {
    res.send(data);
  });
});

router.get('/music', function(req, res) {
  request(`${BASE_URL}/api/music/idlist/0`).then(data => {
    res.send(data);
  });
});

router.get('/music/month/:month', function(req, res) {
  request(`${BASE_URL}/api/music/bymonth/${req.params.month}`).then(data => {
    res.send(data);
  });
});

router.get('/music/detail/:id', function(req, res) {
  // res.send(req.params.id);
  request(`${BASE_URL}/api/music/detail/${req.params.id}`).then(data => {
    res.send(data);
  });
});
module.exports = router;